<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .father {
        width: 200px;
        height: 200px;
        background-color: pink;
        transform-style: preserve-3d;
        transition: all 0.5s;
      }
      .father:hover {
        animation: circle 2s linear infinite alternate;
      }
      .son {
        width: 200px;
        height: 200px;
        background-color: red;
        transform: translateZ(200px);
      }

      @keyframes circle {
        0% {
          transform: rotateY(0);
        }
        100% {
          transform: rotateY(89deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="father">
      <div class="son"></div>
    </div>
  </body>
</html>
